/*
Title:			pin_macros.h
Author:			Leah Buechley
Date Created:	11/2/2005
Date Modified:  11/2/2005
Purpose: a set of macros that makes accessing pin functions on AVR chips more
		 user-friendly and intuitive
*/

//input 
#define a0_input DDRA &= ~_BV(PA0)
#define a1_input DDRA &= ~_BV(PA1)
#define a2_input DDRA &= ~_BV(PA2)
#define a3_input DDRA &= ~_BV(PA3)
#define a4_input DDRA &= ~_BV(PA4)
#define a5_input DDRA &= ~_BV(PA5)
#define a6_input DDRA &= ~_BV(PA6)
#define a7_input DDRA &= ~_BV(PA7)

#define b0_input DDRB &= ~_BV(PB0)
#define b1_input DDRB &= ~_BV(PB1)
#define b2_input DDRB &= ~_BV(PB2)
#define b3_input DDRB &= ~_BV(PB3)
#define b4_input DDRB &= ~_BV(PB4)
#define b5_input DDRB &= ~_BV(PB5)
#define b6_input DDRB &= ~_BV(PB6)
#define b7_input DDRB &= ~_BV(PB7)

#define c0_input DDRC &= ~_BV(PC0)
#define c1_input DDRC &= ~_BV(PC1)
#define c2_input DDRC &= ~_BV(PC2)
#define c3_input DDRC &= ~_BV(PC3)
#define c4_input DDRC &= ~_BV(PC4)
#define c5_input DDRC &= ~_BV(PC5)
#define c6_input DDRC &= ~_BV(PC6)
#define c7_input DDRC &= ~_BV(PC7)

#define d0_input DDRD &= ~_BV(PD0)
#define d1_input DDRD &= ~_BV(PD1)
#define d2_input DDRD &= ~_BV(PD2)
#define d3_input DDRD &= ~_BV(PD3)
#define d4_input DDRD &= ~_BV(PD4)
#define d5_input DDRD &= ~_BV(PD5)
#define d6_input DDRD &= ~_BV(PD6)
#define d7_input DDRD &= ~_BV(PD7)

#define e0_input DDRE &= ~_BV(PE0)
#define e1_input DDRE &= ~_BV(PE1)
#define e2_input DDRE &= ~_BV(PE2)
#define e3_input DDRE &= ~_BV(PE3)
#define e4_input DDRE &= ~_BV(PE4)
#define e5_input DDRE &= ~_BV(PE5)
#define e6_input DDRE &= ~_BV(PE6)
#define e7_input DDRE &= ~_BV(PE7)

//output
#define a0_output DDRA|= _BV(PA0)
#define a1_output DDRA|= _BV(PA1)
#define a2_output DDRA|= _BV(PA2)
#define a3_output DDRA|= _BV(PA3)
#define a4_output DDRA|= _BV(PA4)
#define a5_output DDRA|= _BV(PA5)
#define a6_output DDRA|= _BV(PA6)
#define a7_output DDRA|= _BV(PA7)

#define b0_output DDRB|= _BV(PB0)
#define b1_output DDRB|= _BV(PB1)
#define b2_output DDRB|= _BV(PB2)
#define b3_output DDRB|= _BV(PB3)
#define b4_output DDRB|= _BV(PB4)
#define b5_output DDRB|= _BV(PB5)
#define b6_output DDRB|= _BV(PB6)
#define b7_output DDRB|= _BV(PB7)

#define c0_output DDRC|= _BV(PC0)
#define c1_output DDRC|= _BV(PC1)
#define c2_output DDRC|= _BV(PC2)
#define c3_output DDRC|= _BV(PC3)
#define c4_output DDRC|= _BV(PC4)
#define c5_output DDRC|= _BV(PC5)
#define c6_output DDRC|= _BV(PC6)
#define c7_output DDRC|= _BV(PC7)

#define d0_output DDRD|= _BV(PD0)
#define d1_output DDRD|= _BV(PD1)
#define d2_output DDRD|= _BV(PD2)
#define d3_output DDRD|= _BV(PD3)
#define d4_output DDRD|= _BV(PD4)
#define d5_output DDRD|= _BV(PD5)
#define d6_output DDRD|= _BV(PD6)
#define d7_output DDRD|= _BV(PD7)

#define e0_output DDRE|= _BV(PE0)
#define e1_output DDRE|= _BV(PE1)
#define e2_output DDRE|= _BV(PE2)
#define e3_output DDRE|= _BV(PE3)
#define e4_output DDRE|= _BV(PE4)
#define e5_output DDRE|= _BV(PE5)
#define e6_output DDRE|= _BV(PE6)
#define e7_output DDRE|= _BV(PE7)

//high
#define a0_high PORTA|= _BV(PA0)
#define a1_high PORTA|= _BV(PA1)
#define a2_high PORTA|= _BV(PA2)
#define a3_high PORTA|= _BV(PA3)
#define a4_high PORTA|= _BV(PA4)
#define a5_high PORTA|= _BV(PA5)
#define a6_high PORTA|= _BV(PA6)
#define a7_high PORTA|= _BV(PA7)

#define b0_high PORTB|= _BV(PB0)
#define b1_high PORTB|= _BV(PB1)
#define b2_high PORTB|= _BV(PB2)
#define b3_high PORTB|= _BV(PB3)
#define b4_high PORTB|= _BV(PB4)
#define b5_high PORTB|= _BV(PB5)
#define b6_high PORTB|= _BV(PB6)
#define b7_high PORTB|= _BV(PB7)

#define c0_high PORTC|= _BV(PC0)
#define c1_high PORTC|= _BV(PC1)
#define c2_high PORTC|= _BV(PC2)
#define c3_high PORTC|= _BV(PC3)
#define c4_high PORTC|= _BV(PC4)
#define c5_high PORTC|= _BV(PC5)
#define c6_high PORTC|= _BV(PC6)
#define c7_high PORTC|= _BV(PC7)

#define d0_high PORTD|= _BV(PD0)
#define d1_high PORTD|= _BV(PD1)
#define d2_high PORTD|= _BV(PD2)
#define d3_high PORTD|= _BV(PD3)
#define d4_high PORTD|= _BV(PD4)
#define d5_high PORTD|= _BV(PD5)
#define d6_high PORTD|= _BV(PD6)
#define d7_high PORTD|= _BV(PD7)

#define e0_high PORTE|= _BV(PE0)
#define e1_high PORTE|= _BV(PE1)
#define e2_high PORTE|= _BV(PE2)
#define e3_high PORTE|= _BV(PE3)
#define e4_high PORTE|= _BV(PE4)
#define e5_high PORTE|= _BV(PE5)
#define e6_high PORTE|= _BV(PE6)
#define e7_high PORTE|= _BV(PE7)

//low
#define a0_low PORTA &= ~_BV(PA0)
#define a1_low PORTA &= ~_BV(PA1)
#define a2_low PORTA &= ~_BV(PA2)
#define a3_low PORTA &= ~_BV(PA3)
#define a4_low PORTA &= ~_BV(PA4)
#define a5_low PORTA &= ~_BV(PA5)
#define a6_low PORTA &= ~_BV(PA6)
#define a7_low PORTA &= ~_BV(PA7)

#define b0_low PORTB &= ~_BV(PB0)
#define b1_low PORTB &= ~_BV(PB1)
#define b2_low PORTB &= ~_BV(PB2)
#define b3_low PORTB &= ~_BV(PB3)
#define b4_low PORTB &= ~_BV(PB4)
#define b5_low PORTB &= ~_BV(PB5)
#define b6_low PORTB &= ~_BV(PB6)
#define b7_low PORTB &= ~_BV(PB7)

#define c0_low PORTC &= ~_BV(PC0)
#define c1_low PORTC &= ~_BV(PC1)
#define c2_low PORTC &= ~_BV(PC2)
#define c3_low PORTC &= ~_BV(PC3)
#define c4_low PORTC &= ~_BV(PC4)
#define c5_low PORTC &= ~_BV(PC5)
#define c6_low PORTC &= ~_BV(PC6)
#define c7_low PORTC &= ~_BV(PC7)

#define d0_low PORTD &= ~_BV(PD0)
#define d1_low PORTD &= ~_BV(PD1)
#define d2_low PORTD &= ~_BV(PD2)
#define d3_low PORTD &= ~_BV(PD3)
#define d4_low PORTD &= ~_BV(PD4)
#define d5_low PORTD &= ~_BV(PD5)
#define d6_low PORTD &= ~_BV(PD6)
#define d7_low PORTD &= ~_BV(PD7)

#define e0_low PORTE &= ~_BV(PE0)
#define e1_low PORTE &= ~_BV(PE1)
#define e2_low PORTE &= ~_BV(PE2)
#define e3_low PORTE &= ~_BV(PE3)
#define e4_low PORTE &= ~_BV(PE4)
#define e5_low PORTE &= ~_BV(PE5)
#define e6_low PORTE &= ~_BV(PE6)
#define e7_low PORTE &= ~_BV(PE7)
